Slide a rectangle along a sphere
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.