Basil, rosemary, thyme and oregano can all be grown in the same container provided the container is large enough for the roots of all the plants, and provided the rosemary is planted so it does not suffer from over-watering.
The container must be large enough so that the roots --especially the roots of large rosemary plants -- don't crowd each other out. Choose a pot larger than a number five size pot with greater than a 1 cubic foot volume, preferably twice this size or larger to allow all the herbs to fill out.
Strawberry pots are excellent for growing a variety of herbs. They are open at the top, with several pouch-like openings on the side, staggered so that plants can grow up or trail down without interfering with one another. Half whiskey-barrels are large with treated wood sides transferring oxygen well to herb roots while slowing the onset of wood rot.
Plant the rosemary at the top of the strawberry pot or on a mound in the half whiskey barrel. This area will dry out first, and rosemary roots appreciate the dryness. Plant thyme at the edges of the whiskey barrel so they can cascade over the sides, but on a high pocket of the strawberry pot so they have room to cascade down. Plant basil and thyme in the remaining areas.