I'm assuming you know how basic matrix math works, so I'm not going to cover that in my answer.
What you eventually want to do is transform the vertices of the object you want to render from the virtual 3D world to the "real" 2D world (your monitor screen). You do that by multiplying the vertices of the object with a camera matrix (some people may use other terms for this, but it all comes down to basically the same thing). This camera matrix consists of two parts: an external (extrinsic) part and an internal (intrinsic) part.
The extrinsic part is a matrix that transforms the vertex from a 3D world coordinate system to a 3D camera coordinate system. Think this as positioning the camera inside your 3D world. Before the the transformation the vertex is viewed from the origin of the 3D world and after the transformation the vertex is viewed from the origin of the camera. So this is basically part of the answer to your question. If you want to move the camera, you manipulate the extrinsic parameter of the camera matrix (I will come back to this later).
The intrinsic part of the camera matrix is a matrix that transforms the camera coordinate system to an image coordinate system. So this is where the perspective projection takes place.
The extrinsic part of the camera matrix is often called the View matrix (World and Model matrices are related, but are not part of the view matrix). The view matrix is a 4X4 matrix that consists of a 3X3 rotation matrix and a 1x4 translation matrix (as seen below). The rotation matrix determines the orientation of the camera and the translation of the matrix describes the origin of the camera (so this is the camera's position in the virtual 3D world).
The intrincis part of the camera matrix is often called the Projection matrix. This is the matrix that does the actual projection from a 3D coordinate system to a 2D coordinate system. It projects everything in the camera's view frustum to a 2D plane (your monitor).
Now the perspective transformation is defined as follows:
Where: Xim and Yim are your screen coordinates, Fx and Fy define the aspect ratio, S is a skew parameter and Xo and Yo define the focal length (please correct me if I'm wrong about this, my knowledge is kind of rusty for these parameters).
Vertex to screen
So in the end, if you want to transform a vertex coordinate to a screen coordinate you will end up with this:
So, in the end if you want to rotate and move your camera, you need to need to modify the camera's View matrix.
P.S.: From a coding perspective: if you want to know how to construct the View matrix I refer you to this site, which does an excellent job of explaining how to create a LookAt matrix using OpenGL and C++.