Slide a rectangle along a sphere I'm using NASA WorldWind to place a rectangle on the Earth ('sphere'). When I drag the rectangle on the sphere, the rectangle changes shape and size but the dimensions should be preserved.

What is needed to preserve the rectangle's original dimensions when it is dragged along the Earth/sphere?

EDIT

It looks like most of the code in use was copied from this example: http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind/src/gov/nasa/worldwind/util/BasicDragger.java

The line of code in the example that confuses me the most is

double y = event.getMouseEvent().getComponent().getSize().height -
                                       this.dragRefObjectPoint.y + dy - 1;


The resulting behavior is the 'rectangle' that is mapped to the globe changes shape and size.

I also want to point out my experience with computer graphics and NASA worldwind are limited. I'm especially rusty on linear algebra and very weak with geomtery. I'd appreciate suggestions on resources (outside of the obvious NASA WorldWind reference).
If I understand you correctly, the problem could be defined as the (edge) intersection of a cube with a sphere. In that case, you could shade the edges by calculating the distance to the edges of the cube.

//note: from http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float udBox( vec3 p, vec3 b )
{
  return length(max(abs(p)-b,0.0));
}


Aligning the cube poses another "interesting" issue - you probably want to use the sphere-normal and screen-up to generate a basis.