Commit backported fixes from snow-math last year.

Fixes rotation and from_quat output where results were subtly incorrect
depending on the input.