The simple answer is that it very much depends on which format you are playing as the ramifications are very different in stroke play and match play.
But before we answer our headline question, it’s worth clarifying how far in front you have to be for it to be an issue. The ‘teeing area’ has a very precise definition in the Rules of Golf – it isn’t the whole of the mown tee box but rather a rectangle that is two club-lengths in depth, with the forward-most points and outer-most sides of the tee-markers defining its outer limits.
A ball is considered inside the teeing area even if only a tiny part of it overlaps those outer extremities, which does mean that if only part of the ball is in front of the markers there is no issue.
In addition, there is nothing to stop you standing outside the teeing area to play as long as your ball remains within it. This allows you to utilise its full width (depending on the size and shape of the tee-markers) to help you hit your preferred shot shape more comfortably, perhaps where trees encroach.
Now down to nitty-gritty of what happens you if you play from in front of or outside the teeing area or, indeed, from the wrong set of tee-markers, which is effectively the same offence under Rule 6.1b (unless in so doing you would still somehow be within the teeing area for the tee-markers you are supposed to be playing from, which could happen sometimes when different markers are close together).
In stroke play, you incur the general penalty (two strokes) and must then correct your error by playing a ball from inside the teeing area before making a stroke at your next hole, or before returning your scorecard if it’s your final hole. All strokes played with the ball from outside the teeing area are disregarded, but if you don’t correct your mistake in time, the penalty, sadly, escalates to disqualification.
In match play, there is no penalty, but your opponent may immediately request that you cancel the stroke and play another ball from within the teeing area. This, of course, may depend on how good or bad your tee-shot was or how generous they’re feeling that day.
So, this is one of those questions where the answer varies significantly according to which format you are playing.