In order to do this properly you will need to view this problem as having two different coordinate spaces. The world coordinate space, and the screen coordinate space. You will need to create a four parameter point to hold these values [X,Y,Z,W]. X,Y, and Z are self explanitory, however you will need the W parameter for homogenizing. This means to keep all of the other values in proportion after you transform the points from you 3D worldspace to your 2D screen space. In most cases W will be 1, but will be modified after you perform some sort of transformation on it (I will explain the rotation transformation below). After you perform a transformation you will want to normalize the vector that represents your point and replace the homonginized value in W with a 1. The conversion between the 3D world space and 2d screen space is a little complicated to explain right now, and I do not remember the exact formulas in the top of my head, however you could probably find them without trouble on the graphics newsgroup comp.graphics.algorithms, try searching google newsgroups. In order to rotate around the X or the Y access it is easiest to view this if you create a 4x4 matrix.
M11 M12 M13 M14
M21 M22 M23 M24
M31 M32 M33 M34
M41 M42 M43 M44
If you start with the identity matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Then add the particular parameters for the axis of rotation that you want to perform, you will create a transformation matrix. Here are the three matrices that you will use to rotate around the X, Y, and Z axis respectively. X
1 0 0 0
0 cos(angle) -sin(angle) 0
0 sin(angle) cos(angle) 0
0 0 0 1
Y
cos(angle) 0 sin(angle) 0
0 1 0 0
-sin(angle) 0 cos(angle) 0
0 0 0 1
Z
cos(angle) -sin(angle) 0 0
sin(angle) cos(angle) 0 0
0 0 1 0
0 0 0 1
You will place your point at the right of your transformation matrix and perform a multiplication, the result will be a point that is rotated around the origin by the specified angle.
M11 M12 M13 M14 X
M21 M22 M23 M24 Y
M31 M32 M33 M34 Z
M41 M42 M43 M44 1
I know this was a fast introduction to a 3d rotation, however there is quite a bit o ground work that needs to be done in order to get a set of points that are located in 3d space to be properly shown on a 2d screen and to have the perspective of the image pres