Added edge checking for a simulated square on the tile map