A problem on combinatorics, boxes and dispositions I am struggling with the following problem / riddle, which reads:

A tea merchant has five tin tea boxes of cubical shape, which he keeps on his counter in a row.
  Every box has a picture on each of its six sides, so there are thirty pictures in all; but one picture on No. $1$ is repeated on No. $4$, and two other pictures on No. $4$ are repeated on No. $3$. 
  There are, therefore, only twenty-seven different pictures. 
  The owner always keeps No. $1$ at one end of the row, and never allows Nos. $3$ and $5$ to be put side by side.
The tradesman's customer, having obtained this information, thinks it a good puzzle to work out in how many ways the boxes may be arranged on the counter so that the order of the five pictures in front shall never be twice alike. Of course, two similar pictures may be in a row, as it is all a question of their order.

So here is my attempt:
If all the figures on the boxes were different, then we'd have $30$ different pictures, but due to the condition above, we only have $27$ different figures on the boxes.
Now, the other condition is Box $1$ at the end, and $3$ and $5$ never near, which leaves the total combinations (orders) of the boxes to twelve:
$1-2-3-4-5$
$1-3-2-4-5$
$1-3-4-2-5$
$1-3-2-5-4$
$1-3-4-5-2$
$1-4-3-2-5$
Plus the symmetry of the exchange $5\to 3$
So I have $12$ possible dispositions of the boxes.
Now, let's call the figures on each box as
$$1 = \{A_1, A_2, A_3, A_4, A_5, A_6\}$$
$$2 = \{B_1, \ldots, B_6\}$$
$$3 = \{C_1 \ldots C_6\}$$
$$4 = \{D_1, D_2, D_3, A_1, C_1, C_2\}$$
$$5 = \{E_1 \ldots E_6\}$$
The box $4$ is written as this because the text says one figure is on box $1$ and two on box $3$ hence I took box $4$ as the "reference frame$ with less pictures.
Due to this I have managed to work out that, for the combination $1-2-3-4-5$ there are $576$ possible ways to order the boxes in relation to the figures.
But then there are other $11$ dispositions, and I don't know how to cut off the identical orders.
This shall be the solution:

There are twelve ways of arranging the boxes without considering the pictures. If the thirty pictures were all different the answer would be $93,312$. But the necessary deductions for cases where changes of boxes may be made without affecting the order of pictures amount to $1,728$, and the boxes may therefore be arranged, in accordance with the conditions, in $91,584$ different ways. I will leave my readers to discover for themselves how the figures are to be arrived at.

 A: You correctly found the $12$ possible arrangements of the boxes, and if there were $30$ different pictures, you'd have $6^5=7776$ possible picture line-ups per arrangement, for a total of $12\cdot 7776=93312$ possible line-ups.
So, now let's establish how many line-ups are double counted. This is of course when box $4$ is showing some of the repeats.  Now, you may think that when boxes $1$ and $4$ are both showing $A1$ we end up dping some kind of double-counting, but that is not true, since box $1$ is always held at the left: that is, out of the $93312$ line-ups there isn't a single one where the swapping of boxes $1$ and $4$ results in the same line-up that is counted twice, since we never counted twice any line-up with boxes $1$ and $4$ swapped. 
However, boxes $3$ and $4$ can be swapped, and there are $2$ ways in which they can be swapped without box $3$ ending up next to box $5$:


*

*$1-3-4-2-5$ and $1-4-3-2-5$

*$1-5-2-3-4$ and $1-5-2-4-3$
For each of these, there are $4$ ways in which the swapping of boxes $3$ and $4$ results in a line-up already counted before the swap:


*

*They both show $C1$

*They both show $C2$

*Box $3$ shows $C1$ and box $4$ shows $C2$

*Box $3$ shows $C2$ and box $4$ shows $C1$
And finally, given that in each of those ways the other three boxes can show $6^3=216$ possible line-ups between themselves, we find that we have double-counted $2 \cdot 4 \cdot 216=1,728$ line-ups.
A: Editing the answer given by @Bram28
   1. When both boxes(3 and 4)are showing C1. Instead of double counting 
      4 times,it occurs only 2 times in cases:
      1-3-4-2-5       1-5-2-4-3
      1-4-3-2-5       1-5-2-3-4     
      After replacing 3 and 4 by C1 we will get 1-C1-C1-2-5 and 1-5-2-C1-C1

      Cases to be subtracted 2*216 = 432

   2. Similar to above, boxes(3 and 4) are showing C2
      Cases to be subtracted 2*216 = 432

   3. Rest of the 4 cases come from when we take both C1 and C2 together
      (I) we have 12 cases when we replace 3->C1 and 4->C2   and 
      (II)we have 12 cases when we replace 3->C2 and 4->C1
      when comparing all the 24 combination we found that there are 4 cases
      of double counting specifically 
      (I)     1-3-4-2-5     1-4-3-2-5    1-5-2-3-4   1-5-2-4-3
      (II)    1-4-3-2-5     1-3-4-2-5    1-5-2-4-3   1-5-2-3-4
      cases to be subtracted 4*216 = 864

Total 432+432+864 = 1728
