Using today's technology, wouldn't it be possible to equip lightgun with a mini camera, process the image to determine corners of the screen it's looking at, and from that calculate its position/direction?
Kind of like how QR codes are scanned using phone camera.
If needed, one could even upload a display frame (current or near-future one) to the lightgun for use as reference.
Probably this would take some calibration, and sure the image processing would take some cpu/specialized processing hardware, but this being 2023 sounds doable, no? (if not done already)