A quaternion has a vector part and a scalar part. To represent a rotation, a quaternion has to be of unit length. A quaternion that rotates by angle alpha around an axis represented by a normalized vector v is calculated like this:
q = [v*sin(alpha/2), cos(alpha/2)]
The rotation follows the right hand rule.
Now to apply this quaternion to a vector or a point you take your x, y and z and write it as a quaternion. Given a vector v, you can write it in quaternion form as such:
qv = [vx, vy, vz, 0]
Now to transform this vector by a quaternion you premultiply it by the rotation quaternion and postmultiply it by the inverse of the rotation quaternion, as such:
v_rotated = q*qv*q(-1)
, the (-1) means the quaternion is inversed.
To get an inverse of a quaternion you have to calculate it's conjugate and divide it by the quaternion's length squared, but since our quaternion is of unit length, this just means calculating the conjugate. You calculate the conjugate by negating the vector part of the quaternion.
You do this for every vertex like you would with a matrix.
This is from Jason Gregory's "Game Engine Architecture".