#https://www.shadertoy.com/view/lsfGRS

pixels = W:1024 H:1024

x = from 0 to 2 W
y = from 0 to 2 H

d = 1.0
s = 1.0

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

x = abs(x - s)
y = abs(y - s)
s = s*0.5
dx = abs(x) - s
dy = abs(y) - s
c = min(max(dx, dy), 0.0) + length2(max(dx, 0.0), max(dy, 0.0))
d = min(d, c)

o = 1.0 - step(d, 0.0) - d

r = o
g = o
b = o
