Clarifying Blender skeleton animation and OpenGL
A rotation matrix tells you what to do with the components of a vector indicating the position of a point.  For a rotation around X, a vector along X does not change.  At 90 degrees, a vector along Y becomes a vector along Z, and a Z vector becomes -Y.  Rotation about X causes Z and Y to intermingle.  

The fourth row/column do not matter - that is an artifact of doing 3D geometry in projective coordinates. We sometimes call it 'w' and normally just set it to 1.0 and leave it there.  The thing being rotated is a vector representing a direction or position.  

The rotation matrix does the rotating.  Generally, it intermingles components in a two-dimensional subspace, and leaves a one dimension subspace, the axis of rotation, alone.



Quaternions, in contrast, are better thought of (sometimes) as the thing being rotated. No, not rotated, but "acted upon".   For quaternions act a bit odd.  

The First Quirky Principle of Quaternions is that if we want to deal with a rotation of (theta) degrees, we work on the quaternion by half that angle.  

The Second Quirky Principle: instead of having three components like a vector, we add a fourth, conventionally called 'W'. We may call it the "scalar component".  All four components are involved when we "act upon" the quaternion in a way corresponding to some rotation.  I've taken to calling this action "Spotation" for "Spinor Rotation" - in quantum physics, we use "spinors" which amount to the same thing as quaternions.

Consider a rotation about X, as before.  The Y and Z components intermingle, as with a vector, but at half the rotation angle. That is, a 90 degree X rotation which would swap Y and Z (minus signs as appropriate) for a vector, will look like a 45 degree rotation has acted upon the Y and Z components of a quaternion.  (Does Blender S.E allow LaTeX?)

Y' = 1/sqrt(2) Y - 1/sqrt(2) Z
Z' = 1/sqrt(2) Y + 1/sqrt(2) Z


But according to the second quirky principle of quaternions, the "spotation" action intermingles the scalar 'W' component and the X component in a similar manner.  

W' = 1/sqrt(2) W - 1/sqrt(2) X
X' = 1/sqrt(2) W + 1/sqrt(2) X


The exact algebraic rules for doing this were invented by Hamilton in the late 19th Century.  

Generally, a rotation about any axis A will correspond to a "spotation" about the same axis A, but while a given vector that happens to be parallel to A will remain unaffected by the rotation, the corresponding spotation acting on a quaternion whose vector part is along A, will be affected. 

We can relate quaternions to rotations by starting off with a quaternion which is pure scalar, that is,  w,x,y,z = 1,0,0,0.   Then some rotation R about some axis A by angle (theta) will act on the quaternion by converting the W component, being the only nonzero component, into a scalar + vector parallel to A.  



Note that one consequence of the Two Quirky Principles of Quaternions is that a 180 degree rotation about any axis, which will just negate any vector perpendicular to the axis of rotation, corresponds to a spotation which looks like a 90 degree rotation. If the axis is along X Y or Z, it cleanly trades (with minus signs as needed) between W, Z, Y or Z.   This is a key point to why interpolation of orientation works so nicely with quaternions, as discovered by Ken Shoemake in the 1980s.  Negation of a vector does not offer any natural way to find a half-way point, but quaternions provide that nice hint.

Another interesting consequence is that a 360 rotation, easily confused with "no operation", corresponds to a 180 degree spotation - negation of all four components of the spinor. I mean, quaternion.  Two different quaternions describe the same orientation of an object.  That sometimes leads to some problems when animating spinning, tumbling, rolling objects, but easily fixed by flipping the sign of a quaternion somewhere in the timeline.  

This also describes the strange antics of quantum particles such as electrons. As a theoretical physicist, I could blabber on and on about how all this arises from deep and beautiful mathematical relations between the rotation group in three dimensions, SO(3), and its double-covering group SU(2), and elegant math using "multivectors", and more, but that's getting off-topic for this site...

(Note: "Quirky Principles of Quaternions" is a phrase I made up on the spot just now, to avoid dealing with any real math. You won't find it in any textbook.)