We are given a matrix $M \in \{0,1\}^{n\times n}$ satisfying the following property.

The rows and columns of $M$ can be partitioned into $k$ *rowgroups* and $k$ *colgroups* respectively, such that **in each** block $B \subseteq M$ induced by these partitions, we have $0$ or more rows and $0$ or more columns of $B$ containing **only** entries equal to $0$, while **all** the remaining entries of $B$ are equal to $1$.

**Question**: What is the maximum rank of $M$?

I only know the maximum rank of $M$ is upper bounded by $k^2$.