precision highp float;
#define iChannel0 inputImageTexture
#define texture(a,b) texture2D(a,fract(b))
#define fragColor gl_FragColor
varying highp vec2 textureCoordinate;

uniform sampler2D inputImageTexture;

uniform float iTime;

highp vec4 pixelate(highp vec2 uv) {
    highp vec2 sampleDivisor = vec2(1./37., 1./87.);
    highp vec2 samplePos = uv - mod(uv, sampleDivisor) + 1.0 * sampleDivisor;
    return texture(iChannel0, samplePos);
}

void main()
{
    highp vec2 uv = textureCoordinate;
    uv *= 2.0;
    int i = int(floor(uv.x)) + int(floor(uv.y)) * 2;
    int cur = int(floor(mod(iTime, 8.0) / 2.0));
    gl_FragColor = i == cur ? texture2D(iChannel0, fract(uv)) : pixelate(fract(uv));
}