The corners of the cube are located at x,y,z = ±1 in the world frame shown as thin lines with endpoints at ±2.
The axes of the camera frame are (initially) parallel to their world-frame counterparts, but the y and z axes of the camera frame point in the opposite direction, respectively.
(In combination with the understanding that the image plane is located in front of the camera center, this gives rise to the negative focal-length parameters in K.)
The rotation matrix R is composed by multiplying the three axis-rotation matrices parametrized by the orientation angles around x, y and z axes, left to right (Euler angles in “x y z” (pitch-roll-yaw) convention).