Use fmod to wrap local rotations (more efficient and robust)