How photons make us locate the position of objects?

The easiest way would be to not just look with one eye, but with two. The image of an object is projected on the retina of each eye, but slightly displaced and the brain can from this compute the distance. It's basically a distance measurement by parallax, i.e. measuring the angle under which the source is seen from two points with a known distance (as is done also in astronomy when measuring the distance to some stars).

There is also the slight possibility that the brain can measure distances somewhat by defocusing the object (the eye's lens is pulsating). The brain could than assess a distance by the relative blur of an object.