I did this with stacks. Unfortunately, there is some tailoring that one must do, depending on the arrangement of boxes, so each particular image must be thought through. The \colblock[color]{rows}{content} is the basic unit. \belowbaseline[length]{} is used in \colblock to align boxes at their top. That and \belowbaseline[length]{} can be used in the code to shift/align boxes. Passing either of them a multiple of \baselineskip would allow some staggering in the vertical box placement.
If the \colblocks are allowed to be rectangular (I assumed square), let me know so that I may correct the answer.
Best Answer
With
{pNiceMatrix}
ofnicematrix
.You need several compilations (because
nicematrix
uses PGF/Tikz nodes under the hood).