# [APL (Dyalog Unicode)], 105 bytes

<!-- language-all: lang-apl -->

    {p←⌊/0~⍨+/⍵⋄i←0⋄{(~×/1=,⍵)∧(⍴⍵)≡+/¨1⌷¨(⍉⍵)⍵}⌽∘⍉⍣{(~⊃⌽⊖⍺)∨i=4⊣i+←1}{×≢⍵:⍵⋄,0}p∧⌿p∧/⍵}{(¯1+⌊⌿c)↓⍵↑⍨⌈⌿c←↑⍸⍵}

[Try it online!][TIO-kkf2so4r]

[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-kkf2so4r]: https://tio.run/##dY7BSsNAEIbvPsVCD5uQhiToScjJS71aX6AoDYGCucqSXiwhidmiiNar9mAOQi8WpSBC@ibzInFms4loMZCdmW9m/vlH0cQ@vxxNLoK6FhEkN1DkjjsFWVoOyDVcz0KELkZhTLcLx/P7iE1IXwyQbyrNniynKj0o3qsSYaagXMdQfEL6qMASlyG/IpI/gNzgfhn6B5AvQwvlvVhsF5A949Zhc7TvxhHegOKLAjmJhVGtPAvtITwzIbmjyeQWnUKREiPzVH/QdD2mUs7pqnxFq9Vqn7rz@@HJEb6ng@NhHeCMwKLdpMtNyTmmBrdtm6PJho15j/vNnMnivYBhrX/6uCIq@4mMsa6j8c4c75r/SOgGJi1uG/rt9NlfDfZbq9dK6CktuXuisa7lvwE "APL (Dyalog Unicode) – Try It Online"

A train of two dfns which takes a matrix of 0's and 1's as argument.

Can be simplified a lot using Jonah's idea.

It simplifies the matrix like so:

```
#####
##### →  ####
   ##       #
```
rotates it to put the corner at the top left:
```
##
#
#
#
```
and then checks if the first row and first column match its shape.