I would like to construct a grid from a matrix. For example, one possible matrix is $M1$.

$$M1=
\begin{pmatrix}
c2 & a1 & a1 & a1 & a1 & a1\\
a2 & b1 & c2 & a1 & a1 & a1\\
a2 & c2 & b2 & a1 & a1 & a1\\
b2 & b2 & c1 & b1 & c2 & a1\\
b2 & c1 & b1 & c2 & b2 & a1\\
a2 & b1 & b1 & a2 & a2 & c2\\
\end{pmatrix}
$$

Each element $a1, a2, \dots, c2$ is represented graphically as the following:
![6vertex][1]

So I want to represent $M1$ as:

![grid representation][2]

Here, how an element, $c2$ fits in the grid is shown as an example.  
Is this possible in *Mathematica*? Currently, I have no idea even where to begin. Any help will be appreciated!

  [1]: https://i.sstatic.net/uckOM.png
  [2]: https://i.sstatic.net/UboJz.png