Export rendered image corners coordinates
This is how to get camera corners 3D positions:

import bpy

cam = bpy.context.scene.camera
frame_local = cam.data.view_frame(bpy.context.scene)

# Its in local space so transform to global
frame_global = [cam.matrix_world * corner for corner in frame_local]

# Output to System console
locations = ["TopRight   ", "BottomRight", "BottomLeft ", "TopLeft    "]
for location, corner in zip(locations, frame_global):
    print("corner {0}: {1}".format(location, corner))


Here you can find more that might interest you:

Casting rays into the scene for each pixel