Speakers almost always benefit from being set away from the wall or corners.
There are a couple of aspects to consider here. First, the farther the speakers are away from the wall, the later reflections off of room surfaces arrive at the listening position. If the distance to the rear wall is short, human hearing cannot tell whether those are room reflections or part of the original signal. So these early reflections can serve to "smear" the image.
There are two ways to deal with this issue. Acoustic panels placed at first reflection points can absorb those early reflections and keep the sound pristine at the listening position. Where are these first reflection points? It is easy to find them with the help of a mirror and an assistant.
While seated in the listening position, have your assistant slide a mirror along the side walls until you see a reflection of the speaker in the mirror. This is a first reflection point. Repeat this for the rear wall and perhaps the ceiling to locate all of these first reflection points.
The second way to deal with these is to position the speakers at least 4 feet from the nearest surfaces. This is not possible in most cases since the rooms are not large enough. But if it is, reflections from surfaces about 4 feet or more from the speaker will be interpreted as room reflections and not as coming directly from the speakers. So no acoustic treatments may be required.
The other aspect of this question relates to the amount of midbass energy you experience. If the speaker is placed close to a wall, these frequencies will be reinforced. This will vary from room to room and from speaker to speaker. For example, we have found that ported speakers are more sensitive to this effect than transmission line speakers. But if your speakers are sounding a little on the "boomy" side, pulling them away from the rear walls and corners will likely improve bass performance.
I hope this helps.
- Jim