Connecting Colored Boxes
In the above diagram, you must connect every colored box with every other colored box that has the same color. You do this by drawing a (not necessarily straight) line connecting the two boxes.
What is the minimum number of line intersections over all possible ways to connect the boxes?
Details and Assumptions
The connecting lines must not go out of the square board.
There cannot be three or more connecting lines concurrent at one point.
Here is one example of a way to connect the boxes with 12 intersections.