APL (Dyalog Unicode), 95 bytes
{p←⌊/0~⍨+/⍵⋄i←0⋄{(⍴⍵)≡+/¨1⌷¨(⍉⍵)⍵}⌽∘⍉⍣{(~⊃⌽⊖⍺)∨i=4⊣i+←1}{×≢⍵:⍵⋄,0}p∧⌿p∧/⍵}{(¯1+⌊⌿c)↓⍵↑⍨⌈⌿c←↑⍸⍵}
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.