https://en.wikipedia.org/wiki/Rotation_matrix would be a great place to start to get a good idea of how you can use a rotation matrix to rotate a vector in 2 or 3 dimensions.
https://stackoverflow.com/questions/22099490/calculate-vector-after-rotating-it-towards-another-by-angle-%CE%B8-in-3d-space This post seems to be roughly what you're looking for.