adds square detection based on QR geometry and clustering