Added function to calculate the inverse of a quaternion.