To sync values from one place to another you can use copy&paste driver.
For example go to Output Properties > Dimension > Resolution X and right-click parametr, from dropdown menu select Copy as New Driver. Go to Shader Editor and right-click above Width parametr and choose Paste Driver. Field became violet which means driver is set. Now by changing Output dimension value will sync with node value.
Do the same for FOV.
To get the math work there are two things ...
- Fix your wrong interpretation of original node tree. If you switch Texture node from Repeat to Clip you can see image is at wrong location. Change math type in second Vector node from Add to Multiply.
- Delete or disable Math conversion from Degrees to Radiance because driver already operates in radiance
To match real camera could be useful this thread.