Screenshot & 2D coordinates

Hi to all,
I have a math problem for you.I’m posting a test scene.

“Screenshot” button takes screenshot of the scene in 1024x1024px.
What I want to do is:
I want to take 2d coordinates(x,y) of blue and red entities , according to the screenshot resolution:)(1024x1024)
So i can put indicators on screenshot.
Remember , this is a perspective view.
I try vec project & worldToScreen methods but no success.Is there any suggestion?Thanks