Detect square