void main(float3 position: POSITION,
          float2 texCoord: TEXCOORD0,

          out float4 outPosition: POSITION,
          out float2 outTexCoord: TEXCOORD0,
          uniform float time,
          uniform float moveDuration,
          uniform float wobbleDuration,
          uniform float wobbleAmplitude,
          uniform float wobbleSize,
          uniform float wobbleSpeed,
          uniform float4x4 modelViewProjectionMatrix, 
          uniform float4x4 modelMatrix) 
{

  
  float z = 4;
  float f = 5;

  float clampMoveTime = min(time, moveDuration);
  float clampWobbleTime = min(time, wobbleDuration);
  float wobbleFactor = wobbleAmplitude * (1 - (clampWobbleTime / wobbleDuration));
  
  float moveFactor = (clampMoveTime / moveDuration) * (clampMoveTime / moveDuration);
  float wobbleForce = wobbleSpeed * wobbleSpeed * (wobbleFactor / wobbleAmplitude) * (wobbleFactor / wobbleAmplitude);
  
   
  float3 r = float3(time * wobbleForce) + position / wobbleSize;  
  float3 x = sin(r) * cos(r) * wobbleFactor;  
  float4 p = float4((position + x) * moveFactor, 1);
  outPosition = mul(modelViewProjectionMatrix, p);
  outTexCoord = texCoord;
}
