WIP: merge imageutils into astropy core

This is a WIP, but is the PR to merge ``imageutils`` into the Astropy core package.

Notes:

* I have attempted to preserve the history but removed code that simply affected affiliated package infrastructure code.
* The branches and merge history *within* imageutils is lost since I rebased this, but I think this is actually less confusing this way. We just have a linear history for the package.
* I also updated issue numbers in the commit messages to always include ``astropy/imageutils``
* This does not include lacosmicx which can be added separately once the licensing is sorted out. Doing that separately will make reviewing this PR easier anyway
* It is marked as critical because this was assessed as 1.0-critical (not a critical bug though)

This is not ready for review or merging, and still needs updates to the docs, tests to pass, etc.

cc @larrybradley @cdeil @adonath @eteq @hamogu @ejeschke

@cdeil - when you say 'using numpy', we'd still provide a function that does that, right? The full implementation of a pure-numpy downsample is:

```
def downsample(image, factor):
    nx_new = image.shape[1] // factor
    ny_new = image.shape[0] // factor
    nx_init = nx_new * factor
    ny_init = ny_new * factor
    return (image[:ny_init, :nx_init]
            .reshape((ny_new, factor, nx_new, factor))
            .mean(axis=3).mean(axis=1))
```

(for the 2-d case), so it's still useful to provide this as a convenience.