Nothing like answering your own question, please up-vote if this helped you!
In C++:
static ConstructorHelpers::FObjectFinder<UMaterial> HudMaterial(TEXT("Material'/Game/UI/HUD/M_Cat.M_Cat'"));
if (HudMaterial.Succeeded())
{
UMaterial* Material = HudMaterial.Object;
CatMaterial = UMaterialInstanceDynamic::Create(Material, this);
}
…
//Shortcut out of here if we do not have a valid texture for our cat
if (!CatTexture) { return; }
FTextureResource* TR = CatTexture->Resource;
float TRX = (float)TR->GetSizeX();
float TRY = (float)TR->GetSizeY();
float U = ((Yaw + CatOffset) / 360.f) * TRX;
float V = 0.f;
float UL = 0.25f * TRX;
float VL = TRY;
FLinearColor CatUV;
CatUV.R = U / TRX;
CatUV.G = 0.f;
CatUV.B = 0.25f;
CatUV.A = 1.f;
CatMaterial->SetVectorParameterValue(FName(TEXT("CatUV")), CatUV);
DrawMaterial(CatMaterial, -0.125f * TRX, -TRY, 0.25f * TRX, TRY, U / TRX, V, 0.25f, 1.f, Opacity, CatColor);
…
void UCatHUDWidget::DrawTexture(UCanvas* CanvasTexture, UTexture* Texture, float X, float Y, float Width, float Height, float U, float V, float UL, float VL, float DrawOpacity, FLinearColor DrawColor, FVector2D RenderOffset, float Rotation, FVector2D RotPivot, bool bIsMask)
{
if (Texture && Texture->Resource)
{
if (bScaleByDesignedResolution)
{
X *= RenderScale;
Y *= RenderScale;
float ImageAspectScale = Height > 0 ? Width / Height : 0.0f;
Height = Height * RenderScale;
Width = (bMaintainAspectRatio) ? (Height * ImageAspectScale) : Width * RenderScale;
}
FVector2D RenderPos = FVector2D(RenderPosition.X + X - (Width * RenderOffset.X), RenderPosition.Y + Y - (Height * RenderOffset.Y));
FTextureResource* TextureResource = Texture->Resource;
uint32 TRX = TextureResource->GetSizeX();
uint32 TRY = TextureResource->GetSizeY();
U = U / TRX;
V = V / TRY;
UL = U + (UL / TRX);
VL = V + (VL / TRY);
DrawColor.A *= DrawOpacity * WAWHUDOwner->WidgetOpacity;
FCanvasTileItem ImageItem(RenderPos, Texture->Resource, FVector2D(Width, Height), FVector2D(U, V), FVector2D(UL, VL), DrawColor);
ImageItem.Rotation = FRotator(0,Rotation,0);
ImageItem.PivotPoint = RotPivot;
ImageItem.BlendMode = bIsMask ? ESimpleElementBlendMode::SE_BLEND_AlphaBlend : ESimpleElementBlendMode::SE_BLEND_Translucent;
CanvasTexture->DrawItem(ImageItem);
}
}
Here is the final material:
http://i.imgur.com/dAbv6gG.png