I am attempting to retrieve the color data for a given sprite located on a texture atlas by creating a new color and passing a source rectangle width and height for the given sprite. I am then passing this color variable into XNA's Texture.GetData method, as seen below. When this code is executed at runtime I receive the following message "Size of the data passed in is too large or too small for this resource."
Texture2D texture = level.Tiles[x, y].Texture;
Rectangle source = level.Tiles[x, y].Source;
Color[] colorData = new Color[source.Width * source.Height];
texture.GetData(colorData);
As far as I am aware this approach should work as it has worked previously with other spritesheets within the application. Could someone please explain why such a message would be thrown in the first place and how I may resolve it?