For your rim, pour salt or sugar onto a small plate. Rub a lime wedge around the edge of a rocks or margarita glass and dip the moistened rim into the salt/sugar until it's evenly coated.
Add the tequila, orange liqueur, cranberry juice, fresh lime juice, and optional simple syrup in a cocktail shaker filled with ice. Shake well.
Strain the margarita into your prepared ice-filled glass. Add the sprig of fresh rosemary and a few fresh cranberries to the drink. You can also drop in the lime wedge you used to rim the glass.