code: function outImgToXYZ(i, j, faceIdx, faceSize) {
  	var a = 2 * i / faceSize,
  			b = 2 * j / faceSize;
  
  	switch(faceIdx) {
  		case 0: // back
  			return({x:-1, y:1-a, z:1-b});
  		case 1: // left
  			return({x:a-1, y:-1, z:1-b});
  		case 2: // front
  			return({x: 1, y:a-1, z:1-b});
  		case 3: // right
  			return({x:1-a, y:1, z:1-b});
  		case 4: // top
  			return({x:b-1, y:a-1, z:1});
  		case 5: // bottom
  			return({x:1-b, y:a-1, z:-1});
  	}
  }
docs: get x,y,z coords from out image pixels coords i,j are pixel coords faceIdx is face number faceSize is edge length