X = [0 1 1 0; 0 0 1 1];

figure;
hold on;
k = 10;
K = [-k,k];
xlim(K); ylim(K);

fill(X(1,:),X(2,:),'r')

Z = X;

Shear = [1 2; 0 1];

Y = Shear*X;
fill(Y(1,:),Y(2,:),'b');
Z = [X Y];


Y = Shear*Y;
fill(Y(1,:),Y(2,:),'g');
Z = [Z Y];

MyRotation =  @(t) [cos(t) -sin(t); sin(t) cos(t)];

for t = [0:pi/2:2*pi];
pause;

Y = MyRotation(t)* Z;
Z = [Z Y];
L = size(X,2);

fill(Y(1,1:L),Y(2,1:L),'r');
fill(Y(1,L+1:2*L),Y(2,L+1:2*L),'b');
fill(Y(1,2*L+1:3*L),Y(2,2*L+1:3*L),'g');
end











