depends on how much trouble you want to go to. you should figure out ways to not rotate those pictures. and if you do, just stick with rotating them, and scolding the user.
you could multiply a rotation matrix onto the camera matrix. don’t dig into the matrices and try to figure out the closed form expressions, that only causes headache.
the distortion coefficients… the radial ones stay. the tangential ones you’d have to look at the equations and figure out what they mean… perhaps just set them to 0 (during calibration).