JavaScript (ES6), 175 166165 bytes
m=>m.map(M=r=>(M|=v='0b'+r|0,m&=v||~0m&=v||m,v),m=~0).map(v=>v?(b=v+(v&-v))&b-1?3:v^m?2^v<M:1:0).join``.match(`^0*(1+${s=(g=m=>m?2+g(m&m-1):'')(m)}|${s}1+)0*$`)&&M*2&M/2&m^m
m.map(M = // start with M zero'ish
r => // for each row r in m[]:
( M |= v = '0b' + r | 0, // turn r into an integer v by parsing it as binary
// and update M by doing M = M OR v
m &= v || ~0m, // if v is not equal to 0, update m by doing m = m AND v
v // yield v as the actual value for the map()
), //
m = ~0 // start with all bits set in m
) // end of map()
input | bin -> dec | M | m
-----------+------------+----+-----
"0000000" | 0 | 0 | ~0
"0100000" | 32 | 32 | 32
"0100000" | 32 | 32 | 32
"0111110" | 62 | 62 | 32
"0000000" | 0 | 62 | 32
input | bin -> dec | M | m
-----------+------------+----+-----
"0000000" | 0 | 0 | ~0
"0100000" | 32 | 32 | 32
"0100000" | 32 | 32 | 32
"0111110" | 62 | 62 | 32
"0000000" | 0 | 62 | 32