title: OpenGL point sprites rotation in fragment shader
body: <p>I'm following <a href="http://en.wikibooks.org/wiki/OpenGL_Programming/Scientific_OpenGL_Tutorial_01" rel="noreferrer">this tutorial</a> to learn something more about OpenGL and in particular point sprites. But I'm stuck on one of the exercises at the end of the page:</p>
  
  <blockquote>
    <p>Try to rotate the point sprites 45 degrees by changing the fragment shader.</p>
  </blockquote>
  
  <p>There are no hints about this sort of thing in the chapter, nor in the previous ones. And I didn't find any documentation on how to do it. These are my vertex and fragment shaders:</p>
  
  <p><strong>Vertex Shader</strong></p>
  
  <pre><code>#version 140
  
  attribute vec2 coord2d;
  
  varying vec4 f_color;
  
  uniform float offset_x;
  uniform float scale_x;
  uniform float point_size;
  
  void main(void) {
      gl_Position = vec4((coord2d.x + offset_x) * scale_x, coord2d.y, 0.0, 1.0);
      f_color = vec4(coord2d.xy / 2.0 + 0.5, 1.0, 1.0);
      gl_PointSize = point_size;
  }
  </code></pre>
  
  <p><strong>Fragment Shader</strong></p>
  
  <pre><code>#version 140
  
  varying vec4 f_color;
  
  uniform sampler2D texture;
  
  void main(void) {
      gl_FragColor = texture2D(texture, gl_PointCoord) * f_color;
  }
  </code></pre>
  
  <p>I thought about using a 2x2 matrix in the FS to rotate the <code>gl_PointCoord</code>, but I have no idea how to fill the matrix to accomplish it. Should I pass it directly to the FS as a uniform?</p>