Vertex/Pixelshader

Maybe this will help a little. This was originally a shader made on a whim to see if i could make a scissors cliping shader with a fade along the edges.

So i altered it really quick to demonstrate moving everything via a world matrix
Or by adding to the vertice positions directly in the shader. It does some stuff to clip in the pixel shader to
It has two shaders the Game2_Alterposition class ( look to the update method ) and the similarly named altered position shader is the one to look at ( the vertex shader ).

The transformation matrix is basically basicEffects world matrix.

I probably should of named it how to vertex shader with spritebatch.

While what you are doing is ok for learning you don’t normally want to try to use these transforms on individual draws its just not rigged that way its mean to be applied to all your draws.

Normally the shaders work off texture positions not pixel positions i know it seems funny but that is actually what makes the gpu a parallel processor that goes so fast.

If you want to see something that is useful and done on a shader just under that idea. This basically demonstrates scrolling textures in place while also alphablending and shading a texture against a second masking texture that makes a cool effect.

If you want to see a equivalent of spritebatch with vertice data completely from the ground up.

Maybe this might help to get a better idea of what spritebatch is doing.
In this post i bypass spritebatch altogether to just draw with quads.
but the effect is just like you would see with spritebatch,

Hope some of this helps.