I'm trying to rotate a set of textures (albedo, roughness, normal) using Texture Coordinate and Mapping nodes in Blender 2.83. Location and Scale properties work properly, but when I change Rotation the shadow isn't right. Looks like direction of light also changes. You can see on the second screen - rotation is 90 degree and it looks like the light is on the bottom and not on the right (considering shadows, not luminosity). On third screen I rotated the plane itself 90 degree and it looks right. I've tried different outputs of Texture Coordinate, types of Mapping and types of Normal Map, but cannot find the right combination. Could you please help?
When you rotate a normal map, a good way of thinking about is that you are rotating the light direction as well. (Which is what you're seeing.)
To rotate correctly by 90°, you'll have to rotate the "light direction" back by -90°.
You can do this swapping the X and Y vectors. You also need to invert the (orig) Y. See here:
This is how you rotate by 180°:
EDIT: Re. angles which aren't multiples of 90°: It is possible, but a bit more complicated.
Here's a node setup:
So, I made a Node Group. Let me know if this works correctly or if I made a mistake. ;)
EDIT2: scurest has added an easier method in the comments: Rotate the output of the Normal Map node via Mapping Node.
So, these two are identical: