Port of #30403 to 5.x. PoseSolver::rot2vec reads the rotation axis
from R - R^T and divides by sin(theta). Both vanish when the rotation
is close to 180 degrees, which is the pose of a square tag seen
exactly head-on, so SOLVEPNP_IPPE_SQUARE returned a pose flipped by
180 degrees. Fall back to Rodrigues in that case and clamp the acos
argument. The fast path for all other rotations is unchanged.