I was able to solve the problem after projecting more objects in the scene. The UV coordinates are mapped correctly into the scene from the point of view of a flat surface (like the table top), but because of that not from the point of view of the camera. It does not have anything to do with coordinates being "off bounds".
Imagine a ladder lying on ...
Clearly the UV editor uses the aspect ratio.
Closing the image in the UV editor on LHS demonstrates that the UV editor is using the aspect ratio of the image when rotating. The LHS rotation result is equivalent to running script result in question, or with unit aspect ratio below.
Instead of our normal 2D rotation matrix,
In Object Properties tab add a custom property:
Right-click its value and choose Copy As New Driver:
Go to your shader and put a Mix RGB node as a switch between the two textures, right-click its Factor input and choose Paste Driver:
In 3D Viewport select your object (in Object Mode), press N to open the Numbers panel, expand Properties section and change ...
I think your problem is in view port settings.
As you wrote, your image RGB goes over variety of colors and the corners should give absolute number of the color (as 1.1.0 in case of yellow) This can be picked by color picker in UV editor or texture paint as the texture is shown without any view port shading.
In fact, the view port has some basic shading and ...
That texture and UV map look like they were designed for a "mirror border" texture lookup: when the texture lookup uses UV outside of 0,1, it mirrors the image over the nearest border. This is a good way to save texture space that is often used in game engines, but Blender doesn't have built-in functionality for it. It's similar to "extend&...
For this, I dissolved the diagonal line going through the middle of my face. I then created a vertical loop cut down the centre of it, like so.
I then Went in the UV editor, selected all the edges of the left side of the face, and moved to be on the skull side of the texture.
All that's needed now is to download the UV: Magic UV Plugin, available in edit/...
Numpy Version with aspect ratio
This question came up wrt How to rotate UV and preserve the correct aspect ratio?
Thought I would also post here.
Using numpy and foreach_get and foreach_set will be noticably
quicker for large meshes. It is quite likely numpy didn't ship with
blender when question was asked / answered.
Deals with aspect ratio.