struct Input {
	float2 vertex_position;
	float2 v_texture_coord;
};

//layout (location = 0) in vec2 vertex_position;
//layout (location = 1) in vec2 v_texture_coord;
struct Output {
	float2 texture_coord;
	float4 pos;
};

float screen_width:SV_Target0;
float screen_height:SV_Target1;
// The 2d coordinates on the screen
// d_rect.x - x cooridinate
// d_rect.y - y cooridinate
// d_rect.z - width
// d_rect.w - height
float4 d_rect:SV_Target2;

Output main(Input input) {
	// Transform the d_rect rectangle to screen space coordinates
	// vertex_position is used to flip and/or rotate the coordinates
	Output output;
	output.pos = float4(
		-1.0 + (2.0 * ((input.vertex_position.x * d_rect.z)  + d_rect.x) / screen_width),
		 1.0 - (2.0 * ((input.vertex_position.y * d_rect.w)  + d_rect.y) / screen_height),
		0.0, 1.0);
	output.texture_coord = input.v_texture_coord;
	return output;
}
