The black square starts in the top left rectangle. Get the key and go through the portal to get to the next section. Get through all of the sections without touching the red rectangle and you win!