#include <metal_stdlib>
using namespace metal;

struct VertexOut {
	float4 position [[position]];
	float2 texCoord;
};

vertex VertexOut vertexShader(uint vertexID [[vertex_id]],
							 constant float4 *vertices [[buffer(0)]]) {
	VertexOut out;
	out.position = float4(vertices[vertexID].xy, 0.0, 1.0);
	out.texCoord = vertices[vertexID].zw;
	return out;
}

fragment float4 fragmentShader(VertexOut in [[stage_in]],
							  texture2d<float> texture [[texture(0)]],
							  constant float4 &tintColor [[buffer(0)]]) {
	constexpr sampler textureSampler;
	float4 color = texture.sample(textureSampler, in.texCoord) * tintColor;
	return color;
}