title: Rotating/aligning texture coordinates
body: <p>I have 1024x1 gradient texture that I want to map to a quad. This gradient should be aligned along the line (p1,p2) inside that quad. The texture has the GL_CLAMP_TO_EDGE property, so it will fill the entire quad.</p>
  
  <p>I now need to figure out the texture coordinates for the four corners (A,B,C,D) of the quad, but I can't wrap my head around the required math.</p>
  
  <p><a href="https://i.stack.imgur.com/cB1SV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cB1SV.png" alt="image"></a></p>
  
  <p>I tried to calculate the angle between (p1,p2) and then rotate the corner points around the center of the line between (p1,2), but I couldn't get this to work right. It seems a bit excessive anyway - is there an easier solution?</p>