Since you want to find the color for every pixel of a flat page, you actually need your mapping the other way around - from a flat page to the photo. Which could be a combination of two: from the flat page to the standard cube, and then - from the standard cube to the photo.
Don't let the word "cube" confuse you, a 2D-cube is just a square.
I have the full explanation right here if you're interested: https://wordsandbuttons.online/biwhatever_transformations.ht...