If I had to to such a thing I would create CSS rules like (Left, Center, Right) and (Top, Middle, Bottom)...This way you need only 6 rules and not 8!
In this rules I would position an image and a div (with the text), both enclosed in an other div and all I have done is assign the right rule to the enclosing div
<div class="L T">
<image alt="" src="" />
<div>[text]</div>
</div>
Now - you can load those rule names from the server side or set by a single jQuery method...Of no more than one and a half line...