GIS software such as arcGIS allows you to georeference a raster by marking specific points that have known coordinates. It will run a regression that reprojects your raster in such a way that minimizes the squared distance between these points on the raster and their "real" coordinates. (Good summary here.)
I'd like a way to do this in R. If the feature doesn't exist, I'd be willing to implement it myself. However, in order to do this, I need a way to apply an arbitrary polynomial transformation to a raster, using bilinear interpolation or a similar method. I'm aware that I can easily reproject a raster with a known projection and datum into a different projection and datum, but I need a capability that is more general.
Edit: Stack Overflow suggests I edit my answer to explain how this question is different from existing questions, but the existing answers deal with reprojection into a known coordinate system. I need to reproject into an arbitrary system, determined by the control points.