title: Simple vertex shader not working correctly in Monogame
body: <p>I am very new to both shaders and to Monogame, so forgive me if I am missing something obvious.</p>
  
  <p>I am following this tutorial very loosely: <a href="http://www.david-gouveia.com/portfolio/scrolling-textures-with-zoom-and-rotation/" rel="nofollow noreferrer">http://www.david-gouveia.com/portfolio/scrolling-textures-with-zoom-and-rotation/</a></p>
  
  <p>I want exactly the same effect as in the tutorial in my own game: a texture that draws based on the camera rotation/zoom/position.</p>
  
  <p>Here is my shader code:</p>
  
  <pre><code>sampler TextureSampler : register(s0);
  
  struct VertexShaderInput
  {
      float4 Color: COLOR0;
      float2 TexCoord : TEXCOORD0;
      float4 Position : SV_Position0;
  };
  
  struct VertexShaderOutput
  {
      float4 Color: COLOR0;
      float2 TexCoord : TEXCOORD0;
      float4 Position : SV_Position0;
  };
  
  float2   ViewportSize;
  float4x4 ScrollMatrix;
  
  VertexShaderOutput SpriteVertexShader(VertexShaderInput input)
  {
      VertexShaderOutput output;
      float4 position = input.Position;
  
      // Half pixel offset for correct texel centering.
      position.xy -= 0.5;
  
      // Viewport adjustment.
      position.xy = position.xy / ViewportSize;
      position.xy *= float2(2, -2);
      position.xy -= float2(1, -1);
  
      // Transform our texture coordinates to account for camera
      output.TexCoord = mul(float4(input.TexCoord.xy, 0, 1), ScrollMatrix).xy;
      output.Position = position;
      output.Color = input.Color;
  
      return output;
  }
  
  technique SpriteBatch
  {
      pass
      {
          VertexShader = compile vs_4_0_level_9_1  SpriteVertexShader();
      }
  }
  </code></pre>
  
  <p>I load it into monogame:</p>
  
  <pre><code>Effect effect = content.Load&lt;Effect&gt;("SpriteEffects\\infinite");
  effect.Parameters["ViewportSize"].SetValue(new Vector2(viewport.Width,viewport.Height));
  </code></pre>
  
  <p>Function for getting the Effect at drawing:</p>
  
  <pre><code>public Effect getScrollEffect()
          {
              //This should use a matrix based on the camera, but I'm using an Identity matrix for testing
              effect.Parameters["ScrollMatrix"].SetValue(Matrix.Identity);
              return effect;
          }
  </code></pre>
  
  <p>And then drawing it:</p>
  
  <pre><code>spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null, getScrollEffect());
  spriteBatch.Draw(texture, viewport.Bounds, viewport.Bounds, Color.White);
  spriteBatch.End();
  </code></pre>
  
  <p>The texture looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eP5Be.png" alt="enter image description here"></p>
  
  <p>My result looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/VO5Ag.jpg" alt="enter image description here"></p>
  
  <p>What is going on?  My shader doesn't even touch the color.  Even when I remove the "Color" variable from the input and output it turns out the same.  It looks like it is somehow confusing the coordinates of one variable with color values somehow.  Am I using the shader wrong?</p>
  
  <p>Thank you for your help.</p>