Rotation about an arbitrary axis
Rotation about an arbitrary axis is a composition of several rotations and translation operations. What you need to do is the following:
a) If the axis passes through the origin, perform the sequence of rotations so that it aligns with one of the coordinate axes. Then perform the required rotation of the object. Finally apply the reverse sequence of inverses rotations so that the axis attains its original orientation.
b) If the axis does not pass through the origin, translate the axis to make it pass through the origin. Perform the operations as given in (a) above and then translate the axis back to its original position.