#define iChannel0 inputImageTexture
#define texture(a,b) texture2D(a,fract(b))
#define fragColor gl_FragColor

precision highp float;

varying highp vec2 textureCoordinate;

uniform sampler2D inputImageTexture;

float insideBox(vec2 v, vec2 bottomLeft, vec2 topRight, vec2 smoothv) {
    vec2 s = smoothstep(bottomLeft - smoothv * 0.5, bottomLeft + smoothv * 0.5, v) - smoothstep(topRight - smoothv * 0.5, topRight + smoothv * 0.5, v);
    return s.x * s.y;
}

void main()
{
    highp vec2 uv = textureCoordinate;

    uv.y = mod(uv.y, 0.333) + 0.333;

    float a = abs(abs(uv.y - 0.5) - 0.333 * 0.5);
    a = smoothstep(0.002, 0.010, a);

    fragColor = mix(vec4(vec3(0.0), 1.0), texture(iChannel0, uv), a * insideBox(textureCoordinate, vec2(0.03), vec2(0.97), vec2(0.012)));
}
