fix: recalculate grid span count after rotation (#4935)