Not sure if you're still looking for an answer at this point but I think I have one. If you have the x, y, and z components of a point on the unit sphere, then dividing each point by the maximum absolute value of the coordinates will take you to a cube centered at the origin ($[-1,1]\times [-1,1] \times [-1,1]$).
What I think you're trying to do is, given a camera position, send a ray through each pixel on a screen, and given that ray's direction, return the appropriate color for the pixel based on the images.
Assuming you're constructing each scene out of six images - up, down, left, right, front, and back - what you're trying to create is known as a cubemap in computer graphics. There's is probably a lot of software out there for generating cubemaps based on images. I've never written software like this myself but if I had to guess all it involves is taking the unit vector which represents a pixels direction, applying the map I described in the first paragraph which gets you on the cube, and from there just identify which face of the cube it's on, and do an orthographic projection to get the necessary coordinates to sample the image.