Fix screen orientation rotation matrix and quaternion JavaScript code snippets